﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ZJCQ
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ZJCQ;

    class ZJ_extract_detail_bak_map : EntityMapping<ZJ_extract_detail_bak>
    {
        public ZJ_extract_detail_bak_map()
        {
            Property(x => x.is_selected, map =>
            {
                map.Column(ZJ_extract_detail_bak.Columns.is_selected);
            });

            Property(x => x.order_flag, map =>
            {
                map.Column(ZJ_extract_detail_bak.Columns.order_flag);
            });

            Property(x => x.un_selected_msg, map =>
            {
                map.Column(ZJ_extract_detail_bak.Columns.un_selected_msg);
            });

            Property(x => x.exp_new_mobile, map =>
            {
                map.Column(ZJ_extract_detail_bak.Columns.exp_new_mobile);
            });

            Property(x => x.exp_new_profession, map =>
            {
                map.Column(ZJ_extract_detail_bak.Columns.exp_new_profession);
            });

            //与专家分类记录关联
            Bag(x => x.exp_new_categorys,
                map =>
                {
                    map.Key(km => km.Column(DB_Model.ZJK.ZJ_category.Columns.id));
                },
                act => act.ManyToMany());

            //与抽取记录关联
            ManyToOne(x => x.extract_bak, map =>
            {
                map.Column(ZJ_extract_detail_bak.Columns.extract_bak_id);
            });

            //与专家记录关联
            ManyToOne(x => x.expert, map =>
            {
                map.Column(ZJ_extract_detail_bak.Columns.expert_id);
            });

            Table(ZJ_extract_detail_bak.TableName);
        }
    }
}
